@extends('orange.layouts.indexPublic')
@section('title'){{ $companyinfo->company_name.' - 招聘主页'}} @endsection
{{--公司详情页css--}}
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/orange/css/index/comabout.css')}}">
    <link rel="stylesheet" href="{{asset('/vendor/swiper/skin/swiper2.7.6.css')}}">
@endsection

{{--主体内容--}}
@section('content')
    {{--主导航--}}
    @include('orange.layouts.mainNav')
    {{--主导航结束--}}

    {{--主要内容--}}
    <div class="main">
        <div class="wrapper">
            {{--主要内容--}}
            <div class="content">
                {{--基本信息--}}
                <div class="baseInfo">
                    <div class="compPhoto">
                        <img src="{{ $companyinfo->logo }}" alt="公司图标">
                    </div>
                    <p class="name">
                        <span>{{ str_limit($companyinfo->company_name,70) }}</span>
                        @if($companyinfo->cert_status==0)
                            <span class="noCertificate">未认证</span>
                        @else
                            <span class="iconCertified"></span><span class="certificated">已认证</span>
                        @endif
                    </p>
                    @if(count($companyinfo->temptation) > 0)
                        <ul class="welfare">
                            @foreach($companyinfo->temptation as $v)
                                <li>{{ $v }}</li>
                            @endforeach
                        </ul>
                    @endif
                    <ul class="box">
                        <li><p class="p1">23个</p><p class="p2">招聘职位</p></li>
                        <li><p class="p1">96%</p><p class="p2">简历及时处理率</p></li>
                        <li class="noBorderRight"><p class="p1">今天</p><p class="p2">企业最近登录</p></li>
                    </ul>
                    <a id="toShare" class="toShare" href="javascript:void(0)"></a>
                </div>
                {{--基本信息结束--}}

                {{--公司介绍--}}
                <div class="introduce">
                    <h2><span>公司简介</span></h2>
                    <div class="box">{!! nl2br(e($companyinfo->profile)) !!}</div>
                    @if(count($photo)>0)
                        <div id="introduceSlider" class="slider">
                            <div class="slideBox swiper-container">
                                <ul class="play-mid-list swiper-wrapper">
                                    @foreach($photo as $k => $v)
                                        @if(!empty($v))
                                            <li class="swiper-slide swiper-no-swiping"><img layer-src="{{asset('upload/companyphoto/'.$v['file'])}}" src="{{asset('upload/companyphoto/'.$v['file'])}}" width="263" height="192" alt="{{ $v['remark'] or '' }}"></li>
                                        @endif
                                    @endforeach
                                </ul>
                            </div>
                            <div class="play-mid-btn play-mid-BL"></div>
                            <div class="play-mid-btn play-mid-BR"></div>
                        </div>
                    @endif
                    <button class="retract">收起<i></i></button>
                </div>
                {{--公司介绍结束--}}

                {{--全部职位--}}
                <div class="otherJobs">
                    <h2><span>在招职位</span></h2>
                    <ul>
                        @if(count($jobinfo) > 0)
                            @foreach($jobinfo as $jobinfo_value)
                                <li>
                                    <span class="col1">
                                        <a href="{{url('jobinfo_'.idEncryption($jobinfo_value->id).'.html')}}">{{ str_limit( $jobinfo_value->job_title,26) }}</a>
                                        @if(!empty($jobinfo_value->part_status) && $jobinfo_value->part_status == '2')
                                            <i class="two status"></i>
                                        @elseif(!empty($jobinfo_value->part_status) && $jobinfo_value->part_status == '3')
                                            <i class="three status"></i>
                                        @elseif(!empty($jobinfo_value->part_status) && $jobinfo_value->part_status == '4')
                                            <i class="four status"></i>
                                        @endif
                                    </span>
                                    <span class="col2">@if(empty($jobinfo_value->salary_above) and empty($jobinfo_value->salary_below)){{'面谈'}}@else{{ $jobinfo_value->salary_above.'-'.$jobinfo_value->salary_below }}@endif</span>
                                    <span class="col3">
                                        {{ str_limit($jobinfo_value->location,24) }} |
                                        @if($jobinfo_value->work_year == 0)
                                            经验不限
                                        @else
                                            {{$jobinfo_value->work_year}}年以上
                                        @endif
                                    </span>
                                    <span class="col4">{{ $jobinfo_value->updatetime }}</span></li>
                            @endforeach
                        @endif
                    </ul>
                    {{--<button class="seeMore" id="">查看更多<i></i></button>--}}
                </div>
                {{--全部职位结束--}}
            </div>
            {{--主要内容结束--}}

            {{--侧边栏--}}
            <div class="aside">
                <h2><span>联系方式</span></h2>
                <p><span>联 系 人</span>{{ $companyinfo->contacts }}</p>
                <p><span>联系电话</span>{{ $companyinfo->phone or '' }}</p>
                <p><span>公司网址</span>{{ $companyinfo->website }}</p>
                <p><span>电子邮箱</span>{{ $companyinfo->email }}</p>
                <p><span>公司地址</span>{{ $companyinfo->address }}</p>
                <div class="mapThumbnail">
                    <div id="map">
                        <iframe name="baiduMap" id="baiduMap" width="250" height="160" src="{{ route("baiduMap",["cid"=>idEncryption($companyinfo->id)]) }}" scrolling="no" frameborder="0"></iframe>
                    </div>
                    <a id="seeMap" class="seeMap" href="javascript:void(0)">查看地图</a>
                </div>
            </div>
            {{--侧边栏结束--}}
        </div>
    </div>
    {{--主要内容--}}
@endsection

{{--公司详情页js--}}
@section('js')
    @parent
    <script type="text/javascript" src="{{ asset('/vendor/swiper/swiper2.7.6.min.js') }}"></script>
    <script>
        $(function(){
            //搜索栏中搜索条件选择
            $('.logoAndSearch select.select').select();

            //创建轮播图
            var mySwiper = new Swiper('#introduceSlider .swiper-container',{
                autoplay : 3000,//可选选项，自动滑动
                loop : true,//可选选项，开启循环
                slidesPerView: 3, //同时显示的slides数量
                noSwiping: true, //使该slide无法用鼠标点击滑动
                onFirstInit:function(){
                    //点击弹出大图
                    layer.ready(function(){
                        layer.photos({
                            photos: '.slideBox',
                            shift:5
                        });
                    });
                }
            });
            //swiper-slide鼠标事件
            $('#introduceSlider .swiper-slide').mouseenter(function(){//鼠标移上
                mySwiper.stopAutoplay();
                $('#introduceSlider .play-mid-btn').show();
                //鼠标移开
                $(this).mouseleave(function(){//鼠标移开
                    mySwiper.startAutoplay();
                    $('#introduceSlider .play-mid-btn').hide();
                });
            });
            //前进后退按钮鼠标事件
            $('#introduceSlider .play-mid-btn').mouseenter(function(){//鼠标移上
                mySwiper.stopAutoplay();
                $('#introduceSlider .play-mid-btn').show();
                $(this).click(function(){//鼠标点击
                    if($(this).hasClass('play-mid-BL')){
                        mySwiper.swipePrev();
                    }else{
                        mySwiper.swipeNext();
                    }
                });
                $(this).mouseleave(function(){//鼠标移开
                    mySwiper.startAutoplay();
                });
            });
            //轮播图结束

            var $box = $('.introduce .box');
            checkBoxHeight($box);

            //公司简介收起按钮
            $('.introduce .retract').click(function(){
                var html = $(this).html();
                if(html.indexOf('收起') > -1){
                    $(this).html('查看'+'<i></i>').addClass('seeMore').siblings('.box').addClass('retracted')
                            .siblings('.slider').css('display','none');
                }else{
                    $(this).html('收起'+'<i></i>').removeClass('seeMore').siblings('.box').removeClass('retracted')
                            .siblings('.slider').css('display','');
                }
            });

            //分享
            $("#toShare").click(function(){
                layer.open({
                    type: 1,
                    title:'分享朋友圈',
                    skin: 'layer-toShare',
                    area: ['240px', '295px'],
                    resize:false,
                    move:false,
                    btn:false,
                    content:'<div class="box"><img src="{{url('to_share?com_id='.$companyinfo->id)}}"></div><div style="text-align: center">扫一扫分享到朋友圈</div>'
                });
            });
            //侧边栏查看地图按钮
            $("#seeMap").click(function(){
                var index = parent.layer.getFrameIndex("baiduMap");
                layer.open({
                    type: 1,
                    title: '查看地图',
                    skin: 'layer-seeMap',
                    area: ['865px', '570px'],
                    resize: false,
                    move: false,
                    btn: false,
                    content: '<iframe frameborder="0" name="baiduMap" id="baiduMap" width="830" height="500" src="{{ route("baiduMap",["cid"=>idEncryption($companyinfo->id)]) }}" scrolling="no"></iframe>'
                });
            });
        });

        //判断公司简介box高度，如果高度大于30px则显示收起按钮
        function checkBoxHeight($el){
            var height = $el.outerHeight();
            if(height <= 60 && $('.slider').length <= 0){
                $el.siblings('.retract').css('display','none');
            }
        }
    </script>
@endsection